import App from './App'
import uvUI from '@/uni_modules/uv-ui-tools'
import { Request } from '@/util/request/index'

// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
  ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
import * as Pinia from 'pinia';
import Api from '@/common/request'
// import vConsole from './vconsole.js'

export function createApp() {
	const app = createSSRApp(App)
	app.use(Pinia.createPinia());
	
	let token = window.sessionStorage.getItem('token')
	if(token) {
		Api.token = token
	}
	uni.$api = Api;
	app.config.globalProperties.$api = Api
	Request(app)
	app.use(uvUI);
	
  return {
    app,
	Pinia
  }
}
// #endif